<template>
    <div class="grandSon">
        <h2>孙子组件</h2>
        <h4>{{ gfMsg }}</h4>
        <button @click="changePassedMsg">改变消息</button>
    </div>

</template>

<script setup>
import { inject } from 'vue';
const gfMsg = inject('GFMsg')
const changeStr = inject('methodChangeMsg')
const changePassedMsg = () => {
    changeStr()
}
</script>

<style scoped>
.grandSon {
    padding: 51px;
    border: 2px solid pink;
}
</style>